﻿@{
    ViewBag.Title = "商拓软件科技_重新设置密码";
    Layout = null;
}

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <link rel="stylesheet" type="text/css" href="~/themes/kingcens/css/reset.css">
    <link rel="stylesheet" type="text/css" href="~/themes/kingcens/css/style.css">
    <link rel="stylesheet" type="text/css" href="~/themes/kingcens/css/tip-darkgray.css">
    <link rel="stylesheet" type="text/css" href="~/themes/kingcens/css/tip-green.css">
    <link rel="stylesheet" type="text/css" href="~/themes/kingcens/css/tip-skyblue.css">
    <link rel="stylesheet" type="text/css" href="~/themes/kingcens/css/tip-twitter.css">
    <link rel="stylesheet" type="text/css" href="~/themes/kingcens/css/tip-violet.css">
    <link rel="stylesheet" type="text/css" href="~/themes/kingcens/css/tip-yellow.css">
    <link rel="stylesheet" type="text/css" href="~/themes/kingcens/css/tip-yellowsimple.css">
    <link href="@Url.Content("~/Scripts/miniui/themes/default/miniui.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Scripts/miniui/themes/icons.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Scripts/miniui/themes/jqueryui-cupertino/skin.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/miniui/miniui.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/themes/kingcens/js/jquery.tooltip.js")" type="text/javascript"></script>
</head>
<body>
    <div class="hander">
        <div class="hander-center">
            <a href="#" class="logo" title="logo">
                <img src="~/themes/kingcens/images/logo.png"></a>
        </div>
    </div>
    <div class="min">
        <div class="content-layout">
            <div class="login-box-warp1">
                <div class="login-title"><span>重置密码</span></div>
                <div class="static-form">
                    <form role="form" id="form1" action="@Url.Action("ReinstallPassword")" method="post"  onClick="return submitForm()">
                        <div class="field pwd-field">
                            <label class="userpwd"></label>
                            <span>
                                <input class="logo-pwd" type="password" name="password" id="password" onclick="clearError" value="@ViewBag.pwd" placeholder="请输入密码(6至16个字符)" msg="密码由大小写字母及数字组成，且6至16个字符。请重新输入。"></span>
                        </div>
                        <div class="field pwd-field">
                            <label class="userpwd"></label>
                            <span>
                                <input class="logo-pwd" type="password" name="password2" id="password2" onclick="clearError" value="@ViewBag.pwd2" placeholder="再次输入密码(6至16个字符)" msg="密码由大小写字母及数字组成，且6至16个字符。请重新输入。"></span>
                        </div>
                        <div class="submit-bnt" style="margin-top: 15px;">
                            <button class="btn">重置密码</button>
                        </div>
                        <!--<div class="copy-info">当前版本 <em>v6.1.2.0</em></div>-->
                        <input type="hidden" name="error" id="error" value="@ViewBag.error" />
                        <input type="hidden" name="errorCode" id="errorCode" value="@ViewBag.errorCode" />
                    </form>
                </div>
            </div>
        </div>
    </div>
    <div class="footer">
        <div class="foot-center clearfix">
            <div class="foot-info">
                <p class="name">广州商括软件科技有限公司</p>
                <p class="link">官方网址:http//www.pos88.com</p>
            </div>
        </div>
    </div>
</body>
<script>

    function initalpassword(msg) {
        if (msg != "")
            $("#password").attr("msg", msg);
        $('#password').poshytip({
            className: 'tip-twitter',
            showOn: 'focus',
            alignTo: 'target',
            alignX: 'center',
            alignY: 'bottom',
            offsetX: 0,
            offsetY: 5
        });
    }
    function initalpassword2(msg) {
        if (msg != "")
            $("#password2").attr("msg", msg);
        $('#password2').poshytip({
            className: 'tip-twitter',
            showOn: 'focus',
            alignTo: 'target',
            alignX: 'center',
            alignY: 'bottom',
            offsetX: 0,
            offsetY: 5
        });
    }

    ck = "";
    $(function() {

        mini.parse();
        initalpassword();
        initalpassword2();

        $("#password").click(function () {
            $("#password").poshytip("disable");
        });
        $("#password2").click(function () {
            $("#password2").poshytip("disable");
        });

        $(".btn").click(function () { ck = "submit"; });
        if ($("#error").val() != "") {
            var data = JSON.parse($("#error").val());
            if (data.success == 1) {
                mini.alert(data.msg);
                window.location.href = "../Home/Login";
            }
            else {
                mini.showTips({ content: data.msg, state: "danger", x: "center", y: "top", timeout: 5000 });
            }
        }
    });

    function clearError() {
        $(".identify").html("");

    }
    function submitForm() {
        if (ck == "submit") {
            var retvalue = true;
            var password = $("#password").val();
            var password2 = $("#password2").val();
            if (password != password2 && retvalue) {
                initalpassword2("两次输入密码不相同！请重新输入。");
                $("#password2").poshytip("enable");
                $('#password2').poshytip('show');
                retvalue = false;
            }
            var pwdreg = /[a-zA-Z0-9]{6,16}/;
            if (!pwdreg.test(password) && retvalue) {
                $("#password").poshytip("enable");
                $('#password').poshytip('show');
                retvalue = false;
            }
            ck = "";
            if (retvalue)
                return true;
            else {
                return false;
            }
        }
        else
            return false;
    }
</script>
